﻿using Shop.RemoteModel.Coupon;
using Shop.RemoteModel.Coupon.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class CouponEvent : IRpcApiService
    {
        private readonly ICouponService _Service;

        public CouponEvent (ICouponService service)
        {
            this._Service = service;
        }

        public long AddCoupon (AddCoupon data)
        {
            return this._Service.Add(data.Datum);
        }

        public void DeleteCoupon (DeleteCoupon obj)
        {
            this._Service.Delete(obj.Id);
        }

        public bool EnableCoupon (EnableCoupon obj)
        {
            return this._Service.Enable(obj.Id);
        }

        public CouponDto GetCoupon (GetCoupon obj)
        {
            return this._Service.Get(obj.Id);
        }

        public bool Offshelf (OffshelfCoupon obj)
        {
            return this._Service.Offshelf(obj.Id);
        }

        public PagingResult<CouponDatum> QueryCoupon (QueryCoupon query)
        {
            return this._Service.Query(query.Query, query.ToBasicPage());
        }

        public bool SetCoupon (SetCoupon data)
        {
            return this._Service.Set(data.Id, data.Datum);
        }

        public bool StopCoupon (StopCoupon obj)
        {
            return this._Service.Stop(obj.Id);
        }
    }
}
